﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Dynamic;
using EIIS.Infrastructure.Repositories;
using EIIS.Infrastructure.Repositories.System;
using EIIS.Infrastructure.Model.System;

namespace EIIS.Infrastructure.Repositories.Implement
{
    public class DicCategoryRepository : RepositoryBase<DicCategory>,IDicCategoryRepository
    {
        public IQueryable<DicCategory> LoadAllByPage(out long total, int page, int rows, string order, string sort)
        {
            var list = this.LoadAll();
            total = list.LongCount();
            if (!string.IsNullOrEmpty(order) && !string.IsNullOrEmpty(sort))
            {
                list = list.OrderBy(sort + " " + order);
            }
            list = list.Skip((page - 1) * rows).Take(rows);

            return list;
        }
    }
}
